#pragma once
#include <sys/types.h> /* See NOTES */
#include <sys/socket.h>
#include <netinet/tcp.h>
#include"InetAddress.h"
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
int createnonblocking();
class Socket
{
public:
    Socket(int fd);
    ~Socket();
    int fd() const;
    void setreuseaddr(bool on);
    void setreuseport(bool on);
    void settcpnodelay(bool on);
    void setkeepalive(bool on);
    void bind(const InetAddress& serveraddr);
    void listen(int gblock=128);
    int accept(InetAddress& clientaddr);

private:
    const int fd_;
};